<?php 
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * File:	function.externallink.php
 * Type:	function
 * Name:	urlencode
 * Purpose:	urlencode text
 * -------------------------------------------------------------
 */
function smarty_function_externallink($params, &$smarty)
{
	if(empty($params['data'])){
		return '';
	}

	try {
	  if(strrpos($params['data'], "http://", -strlen($params['data'])) !== FALSE || strrpos($params['data'], "https://", -strlen($params['data'])) !== FALSE){
	    $output=$params['data'];
	  }else{
	    $output="http://".$params['data'];
	  }
	}
	catch(Exception $e) {
		return $params['data'];
	}
    
    return $output;
}

?>